﻿@{
    Layout = null;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>@ViewBag.LoginTitle</title>
    <link href="~/Content/DWZ/themes/css/login.css" rel="stylesheet" />

    @Scripts.Render("~/bundles/jquery")
    <script>
        function login() {
            var User = $("#User").val();
            var Pwd = $("#Pwd").val();
            var code = $("#code").val();

            /*
            此处暂时屏蔽验证码的校验
            待正式上线后，再放开
            */
            //if (User == "" || Pwd == "" || code == "")
            if (User == "" || Pwd == "" ) {
                alert("账号，密码和验证码不能为空");
                return false;
            }
            $.ajax({
                type: "POST",
                url: "/login/Validate",
                data: "User=" + User + "&Pwd=" + Pwd + "&code=" + code,
                success: function (data) {
                    var json = eval("(" + data + ")");
                    if (json.statusCode == 200) {
                        window.location = '@Url.Action("index", "main")';
                    }
                    else {
                        $("#valiCode").click();
                        $("#code").val("");
                        alert(json.message);
                    }
                }
            });
            //window.location = '@Url.Action("index", "main")';
            return false;
        }
    </script>
</head>
<body>
    <div id="login">
        <div id="login_header">
            <h1 class="login_logo">
                <a href="#"><img src="~/Content/DWZ/themes/default/images/logo.png" height="80px" /></a>
            </h1>
            <div class="login_headerContent">
                <div class="navList">
                    <ul>
                        <li><a href="#">设为首页</a></li>
                        <li><a href="#">反馈</a></li>
                        <li><a href="#">帮助</a></li>
                    </ul>
                </div>
                <h2 class="login_title">
                    <img src="~/Content/DWZ/themes/default/images/login_title.gif" />
                    <span>用户登陆</span>
                </h2>
            </div>
        </div>
        <div id="login_content">
            <div class="loginForm">
                <form action="/login/validate" onsubmit="return login();">
                    <p>
                        <label>用户名：</label>
                        <input type="text" name="User" id="User" class="input" value="" />
                    </p>
                    <p>
                        <label>密码：</label>
                        <input type="password" name="Pwd" id="Pwd" class="input" value="" onpaste="return false" oncopy="return false;" oncut="return false;" />
                    </p>
                    <p>
                        <label>验证码：</label>
                        <input class="input2" name="code" id="code" type="text" size="5" value="" />
                        <span style="padding-top: 5px;">
                            <img id="valiCode" style="vertical-align:top;cursor:pointer;" src="/login/GetValidateCode?@DateTime.Now" alt="验证码"
                                 onclick="this.src='/login/GetValidateCode?time=' + (new Date()).getTime();" />
                        </span>
                    </p>
                    <div class="login_bar">
                        <input type="submit" value=" 登 录 " class="btn-login" />
                    </div>
                </form>
            </div>
            <div class="login_banner"><img src="~/Content/DWZ/themes/default/images/login_banner.jpg" /></div>
            <div class="login_main">
                <ul class="helpList">
                    <li><a href="#"></a></li>
                </ul>
            </div>
            @RenderBody()
        </div>
        <div id="login_footer">
           Ver @System.Reflection.Assembly.LoadFrom(Server.MapPath("~/bin/iLiving.NRP.WebClient.DLL")).GetName().Version.ToString()
        </div>
    </div>
</body>
</html>
